home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / gfx / show / svoUtah22.lha / svoUtahRLE / source / SV_AsmPart.a < prev    next >
Text File  |  1995-04-14  |  10KB  |  380 lines

  1. ; * ************************************************************************ *
  2. ; * 'UtahRLE.svobject' V2.2                                                  *
  3. ; * ************************************************************************ *
  4. ; * (c) 1995 by Andreas Ralph Kleinert. All rights reserved.                 *
  5. ; * This code can be used to create the 'UtahRLE.svobject'.                  *
  6. ; * THIS IS NOT ALLOWED WITHOUT SPECIAL PERMISSION BY THE AUTHOR !!!         *
  7. ; * ************************************************************************ *
  8. ; * Address         : Andreas R. Kleinert                     *
  9. ; *               Grube Hohe Grethe 23                     *
  10. ; *               D-57074 Siegen                         *
  11. ; *               Germany                             *
  12. ; * ************************************************************************ *
  13.  
  14. ; * ************************************************************************ *
  15. ; * Module         : SV_AsmPart.a                         *
  16. ; * Version         : V2.2                             *
  17. ; * Last updated     : 14.4.1995                                    *
  18. ; * Includes         : V40-Includes                                          *
  19. ; * Compiler         : SAS/C V6.55 (ASM)                                     *
  20. ; * Compiler-Options : (smakefile)                                           *
  21. ; * ************************************************************************ *
  22.  
  23.   INCLUDE "exec/types.i"
  24.   INCLUDE "exec/execbase.i"
  25.   INCLUDE "exec/initializers.i"
  26.   INCLUDE "exec/libraries.i"
  27.   INCLUDE "exec/resident.i"
  28.  
  29. VERSION  EQU 2
  30. REVISION EQU 2
  31.  
  32.   XREF _LinkerDB
  33.  
  34.   XREF _LVOOpenLibrary
  35.   XREF _LVOCloseLibrary
  36.   XREF _LVORemove
  37.   XREF _LVOFreeMem
  38.  
  39.   XREF _SVLI_InitSVOList          ; library-internal initialization function
  40.  
  41.   XREF _SVO_AllocHandle
  42.   XREF _SVO_FreeHandle
  43.   XREF _SVO_Show
  44.   XREF _SVO_Write
  45.   XREF _SVO_CloseDisplay
  46.   XREF _SVO_FreeResources
  47.   XREF _SVO_SetAccessMode
  48.   XREF _SVO_SetWriteSubType
  49.   XREF _SVO_SetScreenType
  50.   XREF _SVO_SetWindowFlags
  51.   XREF _SVO_SetWindowIDCMP
  52.   XREF _SVO_GetScreenAddress
  53.   XREF _SVO_GetWindowAddress
  54.   XREF _SVO_SetScreenAddress
  55.   XREF _SVO_SetWindowAddress
  56.   XREF _SVO_SetWriteName
  57.   XREF _SVO_SetReadName
  58.   XREF _SVO_FileInfoRequest
  59.   XREF _SVO_CheckFileType
  60.   XREF _SVO_ReadToGfxBuffer ; added in V2
  61.   XREF _SVO_GetGfxBuffer
  62.   XREF _SVO_SetGfxBuffer
  63.  
  64.   STRUCTURE SVObjectBase,0
  65.    STRUCT svb_LibNode,LIB_SIZE
  66.    ULONG  svb_SVObject
  67.  
  68.    ULONG  svb_Reserved,32
  69.  
  70.    ULONG  svb_SegList
  71.    ULONG  svb_SysBase
  72.    ULONG  svb_DOSBase
  73.    ULONG  svb_IntuitionBase
  74.    ULONG  svb_GfxBase
  75.    ULONG  svb_UtilityBase
  76.    ULONG  svb_MathIeeeDoubBasBase
  77.    ULONG  svb_MathIeeeDoubTransBase
  78.    ULONG  svb_SVSupportBase
  79.   LABEL  svb_SIZEOF
  80.  
  81.   SECTION svb_lib,CODE
  82. ;-------------- `Notausgang` ------------------------------------------------
  83. Start:    moveq #0,d0
  84.     rts
  85. ;-------------- Resident-Struktur -------------------------------------------
  86.  
  87.  
  88. ROMTag:
  89.      dc.w RTC_MATCHWORD
  90.      dc.l ROMTag         ; ptr to itself
  91.      dc.l EndResident    ; ptr to end of Resident-Structure
  92.      dc.b RTF_AUTOINIT   ; Initialisierungsart
  93.      dc.b VERSION         ; Version
  94.      dc.b NT_LIBRARY     ; Node-Typ
  95.      dc.b REVISION         ; Prioritaet
  96.      dc.l SVLibName      ; Name
  97.      dc.l SVLibID         ; LibIDString
  98.      dc.l InitTab         ; ptr to InitTab
  99.  
  100. SVLibName:    dc.b 'UtahRLE.svobject',0
  101. SVLibID:    dc.b 'UtahRLE 2.2 (14.4.95)',13,10,0
  102. AKCopyright:    dc.b '(c) 1995 by Andreas R. Kleinert',0
  103. DosName:    dc.b 'dos.library',0
  104. IntuitionName:    dc.b 'intuition.library',0
  105. GfxName:    dc.b 'graphics.library',0
  106. UtilityName:    dc.b 'utility.library',0
  107. MathIeeeDoubBasName: dc.b 'mathieeedoubbas.library',0
  108. MathIeeeDoubTransName: dc.b 'mathieeedoubtrans.library',0
  109. SVSupportName:  dc.b 'superviewsupport.library',0
  110.         ds.w 0
  111.  
  112. EndResident:
  113.  
  114.  
  115. ;-------------- Funktionstabellen fuer InitStruct u.a. ----------------------
  116. InitTab:
  117.      dc.l svb_SIZEOF      ; LibBase-Size
  118.      dc.l FuncTab          ; Function-Table begin
  119.      dc.l DataTab          ; Data-Table begin
  120.      dc.l InitLib          ; ptr to InitLib
  121. FuncTab:
  122.      dc.l OpenLib          ; internal functions
  123.      dc.l CloseLib
  124.      dc.l ExpungeLib
  125.      dc.l ExtFuncLib
  126.  
  127.          dc.l _SVO_AllocHandle
  128.          dc.l _SVO_FreeHandle
  129.          dc.l _SVO_Show
  130.          dc.l _SVO_Write
  131.          dc.l _SVO_CloseDisplay
  132.          dc.l _SVO_FreeResources
  133.          dc.l _SVO_SetAccessMode
  134.          dc.l _SVO_SetWriteSubType
  135.          dc.l _SVO_SetScreenType
  136.          dc.l _SVO_SetWindowFlags
  137.          dc.l _SVO_SetWindowIDCMP
  138.          dc.l _SVO_GetScreenAddress
  139.          dc.l _SVO_GetWindowAddress
  140.          dc.l _SVO_SetScreenAddress
  141.          dc.l _SVO_SetWindowAddress
  142.          dc.l _SVO_SetWriteName
  143.          dc.l _SVO_SetReadName
  144.          dc.l _SVO_FileInfoRequest
  145.          dc.l _SVO_CheckFileType
  146.          dc.l _SVO_ReadToGfxBuffer ; added in V2
  147.          dc.l _SVO_GetGfxBuffer
  148.          dc.l _SVO_SetGfxBuffer
  149.  
  150.      dc.l -1
  151. DataTab:
  152.      INITBYTE LN_TYPE,NT_LIBRARY
  153.      INITLONG LN_NAME,SVLibName
  154.      INITBYTE LIB_FLAGS,LIBF_SUMUSED!LIBF_CHANGED
  155.      INITWORD LIB_VERSION,VERSION
  156.      INITWORD LIB_REVISION,REVISION
  157.      INITLONG LIB_IDSTRING,SVLibID
  158.      dc.l 0
  159.  
  160. ;-------------- InitLib (Initialisieren der Library) ---------------------------
  161. ;     A0 : &SegList
  162. ;     A6 : &SysBase
  163. ;     D0 : &SVLibrary
  164.  
  165. InitLib:
  166.       movem.l a1/a4-a5,-(sp)       ; a4 und a5 auf Stack retten
  167.  
  168.       lea     _LinkerDB,a4        ; _LinkerDB  -> A4
  169.       move.l d0,a5            ; &SVLibrary -> A5
  170.  
  171.       move.l a6,_SysBase(a4)    ; &SysBase retten
  172.  
  173.       move.l a6,svb_SysBase(a5)  ; &SysBase   -> SVLibrary.svb_SysBase
  174.       move.l a0,svb_SegList(a5)  ; &SegList   -> SVLibrary.svb_SegList
  175.  
  176.       lea DosName,a1
  177.       move.l #37,d0
  178.       LINKLIB _LVOOpenLibrary,_SysBase
  179.       move.l d0,_DOSBase
  180.       move.l d0,svb_DOSBase(a5)        ; save it !
  181.  
  182.       lea IntuitionName,a1
  183.       move.l #37,d0
  184.       LINKLIB _LVOOpenLibrary,_SysBase
  185.       move.l d0,_IntuitionBase
  186.       move.l d0,svb_IntuitionBase(a5)  ; save it !
  187.  
  188.       lea GfxName,a1
  189.       move.l #37,d0
  190.       LINKLIB _LVOOpenLibrary,_SysBase
  191.       move.l d0,_GfxBase
  192.       move.l d0,svb_GfxBase(a5)        ; save it !
  193.  
  194.       lea UtilityName,a1
  195.       move.l #37,d0
  196.       LINKLIB _LVOOpenLibrary,_SysBase
  197.       move.l d0,_UtilityBase
  198.       move.l d0,svb_UtilityBase(a5)        ; save it !
  199.  
  200.       lea MathIeeeDoubBasName,a1
  201.       move.l #33,d0
  202.       LINKLIB _LVOOpenLibrary,_SysBase
  203.       move.l d0,_MathIeeeDoubBasBase
  204.       move.l d0,svb_MathIeeeDoubBasBase(a5)        ; save it !
  205.  
  206.       lea MathIeeeDoubTransName,a1
  207.       move.l #33,d0
  208.       LINKLIB _LVOOpenLibrary,_SysBase
  209.       move.l d0,_MathIeeeDoubTransBase
  210.       move.l d0,svb_MathIeeeDoubTransBase(a5)        ; save it !
  211.  
  212.       lea SVSupportName,a1
  213.       move.l #3,d0
  214.       LINKLIB _LVOOpenLibrary,_SysBase
  215.       move.l d0,_SVSupportBase
  216.       move.l d0,svb_SVSupportBase(a5)        ; save it !
  217.  
  218.           tst.l _DOSBase
  219.           beq InitLib_Fail
  220.           tst.l _IntuitionBase
  221.           beq InitLib_Fail
  222.           tst.l _GfxBase
  223.           beq InitLib_Fail
  224.           tst.l _UtilityBase
  225.           beq InitLib_Fail
  226.           tst.l _MathIeeeDoubBasBase
  227.           beq InitLib_Fail
  228.           tst.l _MathIeeeDoubTransBase
  229.           beq InitLib_Fail
  230.           tst.l _SVSupportBase
  231.           beq InitLib_Fail
  232.  
  233.       move.l a5,_SVObjectBase        ; save Base Address for internal use
  234.  
  235.           jsr _SVLI_InitSVOList
  236.  
  237.       move.l a5,d0                    ; return &SVObjectBase
  238.  
  239.           jmp InitLib_RTS
  240.  
  241. InitLib_Fail:
  242.  
  243.       moveq #0,d0                ; NULL !
  244.  
  245. InitLib_RTS:
  246.  
  247.       movem.l (sp)+,a1/a4-a5
  248.       rts
  249.  
  250.  
  251. ;-------------- OpenLib (Oeffnen der Library) ----------------------------------
  252. OpenLib:
  253.         addq.w #1,LIB_OPENCNT(a6)          ; LIB_OPENCNT ++
  254.         bclr   #LIBB_DELEXP,LIB_FLAGS(a6)  ; clear LIBF_DELEXP
  255.         move.l a6,d0               ; return &SVObjectBase
  256.  
  257.         rts
  258.  
  259. ;-------------- CloseLib (Schliessen der Library) ------------------------------
  260. CloseLib:
  261.         moveq #0,d0
  262.         subq.w #1,LIB_OPENCNT(a6)          ; LIB_OPENCNT --
  263.         bne.s EndCloseLib           ; wenn nicht null, Abbruch
  264.         btst #LIBB_DELEXP,LIB_FLAGS(a6)    ; Test auf LIBF_DELEXP
  265.         beq.s EndCloseLib           ; wenn Null, Abbruch
  266.         bsr.s ExpungeLib           ; wenn gesetzt, ExpungeLib
  267. EndCloseLib:
  268.         rts
  269.  
  270. ;-------------- ExpungeLib (Entfernen der Library) ----------------------------
  271. ExpungeLib:
  272.         movem.l d2/a1/a5-a6,-(sp)
  273.  
  274.         move.l a6,a5               ; &SVLibrary retten
  275.         move.l _SysBase,a6           ; ExecBase to A6
  276.         tst.w LIB_OPENCNT(a5)              ; test LIB_OPENCNT
  277.         beq.s NoOpenLib            ; ...
  278.         bset #LIBB_DELEXP,LIB_FLAGS(a5)    ; set LIBF_DELEXP flag
  279.         moveq #0,d0               ; Ptr auf Segmentliste
  280.         bra.w ExpungeLibEnd           ;
  281. NoOpenLib:
  282.         move.l svb_SegList(a5),d2           ; SegList retten
  283.  
  284.         move.l a5,a1               ; &SVLibrary nach A1 (Par.)
  285.         LINKLIB _LVORemove,_SysBase       ; Library-Node entfernen
  286.  
  287.         move.l _DOSBase,a1
  288.         LINKLIB _LVOCloseLibrary,_SysBase
  289.  
  290.         move.l _IntuitionBase,a1
  291.         LINKLIB _LVOCloseLibrary,_SysBase
  292.  
  293.         move.l _GfxBase,a1
  294.         LINKLIB _LVOCloseLibrary,_SysBase
  295.  
  296.         move.l _UtilityBase,a1
  297.         LINKLIB _LVOCloseLibrary,_SysBase
  298.  
  299.         move.l _MathIeeeDoubBasBase,a1
  300.         LINKLIB _LVOCloseLibrary,_SysBase
  301.  
  302.         move.l _MathIeeeDoubTransBase,a1
  303.         LINKLIB _LVOCloseLibrary,_SysBase
  304.  
  305.         move.l _SVSupportBase,a1
  306.         LINKLIB _LVOCloseLibrary,_SysBase
  307.  
  308.         moveq  #0,d0               ; D0 loeschen
  309.         move.l a5,a1               ; &SVLibrary nach A1 (Par.)
  310.         move.w LIB_NEGSIZE(a5),d0          ; Groesse der
  311.         sub.l d0,a1               ; Library
  312.         add.w LIB_POSSIZE(a5),d0           ; ermitteln !!!
  313.  
  314.         LINKLIB _LVOFreeMem,_SysBase       ; Speicher freigeben
  315.         move.l d2,d0               ; &SegList zurueckgeben
  316. ExpungeLibEnd:
  317.         movem.l (sp)+,d2/a1/a5-a6
  318.         rts
  319.  
  320. ;-------------- ExtFuncLib (bis einschl. OS V2.04 unbenutzt) ---------------
  321. ExtFuncLib:
  322.  
  323.         moveq #0,d0         ; Ist nie falsch ........ - oder ?
  324.         rts
  325.  
  326. ;-------------- Eigene Funktionen ------------------------------------------
  327.  
  328.   SECTION __MERGED,BSS
  329.  
  330. _SVObjectBase:    ds.l 1
  331. _SysBase:    ds.l 1
  332. _DOSBase:    ds.l 1
  333. _IntuitionBase: ds.l 1
  334. _GfxBase:    ds.l 1
  335. _UtilityBase:    ds.l 1
  336. _MathIeeeDoubBasBase: ds.l 1
  337. _MathIeeeDoubTransBase: ds.l 1
  338. _SVSupportBase:    ds.l 1
  339.  
  340. _XCEXIT:    ds.l 1      ; dummy-values to get the compiler's libs work :
  341. __XCEXIT:    ds.l 1
  342. _ONBREAK:    ds.l 1
  343. __ONBREAK:    ds.l 1
  344. __base:     ds.l 1
  345. ___base:     ds.l 1
  346. _ProgramName:    ds.l 1
  347. __ProgramName:    ds.l 1
  348. _StackPtr:    ds.l 1
  349. __StackPtr:    ds.l 1
  350. _oserr:     ds.l 1
  351. __oserr:    ds.l 1
  352. _OSERR:     ds.l 1
  353. __OSERR:    ds.l 1
  354.  
  355.   XDEF _SVObjectBase
  356.   XDEF _SysBase
  357.   XDEF _DOSBase
  358.   XDEF _IntuitionBase
  359.   XDEF _GfxBase
  360.   XDEF _UtilityBase
  361.   XDEF _MathIeeeDoubBasBase
  362.   XDEF _MathIeeeDoubTransBase
  363.   XDEF _SVSupportBase
  364.  
  365.   XDEF _XCEXIT
  366.   XDEF __XCEXIT
  367.   XDEF _ONBREAK
  368.   XDEF __ONBREAK
  369.   XDEF __base
  370.   XDEF ___base
  371.   XDEF _ProgramName
  372.   XDEF __ProgramName
  373.   XDEF _StackPtr
  374.   XDEF __StackPtr
  375.   XDEF _oserr
  376.   XDEF __oserr
  377.   XDEF _OSERR
  378.   XDEF __OSERR
  379.         END
  380.